<%@ page import="vy.org.app.common.*" %>
<%@ page import="org.vy.dal.dao.VyDataUploadJobDO" %>
<%@ page import="java.util.*" %>
<%@ page import="vy.org.app.page.upload.UploadReport" %>
<%@ page import="vy.org.app.page.upload.UploadForm" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%
 List<VyDataUploadJobDO> lst = (List<VyDataUploadJobDO>)request.getAttribute(AppConstants.RESULT);
 UploadReport rpt = (UploadReport)request.getAttribute(AppConstants.REPORT);

 ResourceBundle RESOURCE = ResourceBundle.getBundle("LabelResource",ActionCtx.ctx().getLocale());

%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
	<link rel="stylesheet" type="text/css" href="./css/Common.css">
</head> 
<body bgcolor="white">
<table class="qry" border="0" cellpadding="0" cellspacing="0" width="850px">
	<tr>
        <td><img src="./pages/image_gif/mf.gif" width="100%" height="35"></td>
    </tr> 
  <tr>
  	<td style="background:transparent url('./pages/image_gif/tb_header_blank_strip.gif') repeat-x top left;"><div 
		 style="background:transparent url('./pages/image_gif/tb_header_blank.jpg') no-repeat top right; color:#efefef; padding:3px 30px 3px 10px; float:left; font-size:14px;text-decoration:none;" onClick="toggleOnOff('togrow5')">Bulk Upload</div></td>
  </tr>
</table>
	<form name="uploadForm" action="./FileUpload.do" method="post" enctype="multipart/form-data">
	<br />
		<table width="850px" cellpadding="3" cellspacing="0">
			<tr>
				<td colspan="2" style="font-weight:bold;font-size:16px">Please enter the following details</td>
				<td style="text-align:right;"><a href="./pages/vy_download_data_template.jsp?TID=1">Download Template</a></td>
			</tr>
			<tr>
				<td>File Name</td>
				<td><input type="file" name="theFile" id="theFile"></td>
			</tr>
			<tr>
				<td align="center" colspan="2"><input type="submit" name="upload" value="Upload File"></td>
			</tr>
		</table>
	</form>

<table border="1">
<thead>
	<tr>
	<th>Job Id</th>
	<th>App Id</th>
	<th>Template</th>
	<th>Before Upload</th>
	<th>After Upload</th>
	<th>Total</th>
	<th>Processed</th>
	<th>Failed</th>
	<th>Skipped</th>
	<th>Success</th>
	<th>Status</th>
	<th>Created Date</th>
	</tr>
</thead>
<%
	if(lst != null && !lst.isEmpty()){
		for(VyDataUploadJobDO dto : lst){
			%> 
			<tr>
				<td><%=dto.getJobId() %></td>
				<td><%=dto.getAppId() %></td>
				<td><%=dto.getTemplateId() %></td>
				<td><a target="_blank" href="./bulkupload/<%=dto.getFilePathBefore() %>"><%=dto.getFileName() %></a></td>
				<td><a target="_blank" href="./bulkupload/<%=dto.getFilePathAfter() %>"><%=dto.getFileName() %></a></td>
				<td><%=dto.getTotalRecords() %></td>
				<td><%=dto.getRecordsProcessed() %></td>
				<td><%=dto.getRecordsFailed() %></td>
				<td><%=dto.getRecordsSkipped() %></td>
				<td><%=dto.getRecordsSuccess() %></td>
				<td><%=dto.getStatus() %></td>
				<td><%=_DTFMT.format(dto.getCreatedDate()) %></td>
			</tr>
			<%
		}
	}
%>
</table>
	
</body>
</html> 
 
<%!
	public static SimpleDateFormat _DTFMT = new SimpleDateFormat("dd/MM/yyyy");
%> 
 
